home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
dvivga9.zip
/
DVIVGA.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-10-22
|
17KB
|
619 lines
/* latest revision Oct. 18, 1988 by JDM
/* -*-C-*- dvivga.c */
/*-->dvivga*/
/**********************************************************************/
/******************************* dvivga *******************************/
/**********************************************************************/
#include "dvihead.h"
/**********************************************************************/
/************************ Device Definitions ************************/
/**********************************************************************/
/* All output-device-specific definitions go here. This section must
be changed when modifying a dvi driver for use on a new device */
#undef DEBUG
#define DEBUG 1
#undef VGASCREEN
#define VGASCREEN 1 /* conditional compilation flag */
#undef HIRES
#define HIRES 0 /* this is 72 dpi version */
#define VERSION_NO "2.10" /* DVI driver version number */
#define DEVICE_ID "VGA Screen Previewer"
/* this string is printed at runtime */
#define OUTFILE_EXT "vga"
#define BYTE_SIZE 8 /* output file byte size */
#undef STDRES
#define STDRES 0 /* 0 for low-resolution devices */
#define XDPI 72
#define XPSIZE 8 /* horizontal paper size in inches */
#define XSIZE 640
#define YPSIZE 14
/* 2*HOST_WORD_SIZE */
#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
/* number of words in rows */
/* of bitmap array */
#define YDPI XDPI /* vertical dots/inch */
#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
/* The printer bit map. */
#define XBIT XWORDS
#define YBIT YSIZE
#undef SEGMEM
#define SEGMEM 1
#define MINM 0
int firstlinepage, brokenprtpage;
int neednewpage, neednewbmap;
double newmagfact;
int first_picture = TRUE;
int maxm, nlines, oldvmode, displaycode ;
#include <bios.h>
#include <dos.h>
#include <conio.h>
UNSIGN32* bitmap[YBIT+1] =
{
(UNSIGN32*)NULL /* only first entry need be initialized */
};
#define BITMAP(y,x) (bitmap[y] + (UNSIGN16)(x))
#include "main.h"
#undef STDMAG
#define STDMAG 550
#include "abortrun.h"
#include "actfact.h"
#include "alldone.h"
#include "chargf.h"
#include "charpk.h"
#include "charpxl.h"
#include "clrbmap.h"
#include "clrrow.h"
#include "dbgopen.h"
int far exfn();
int far exfn()
{
devterm();
exit(1);
}
/*-->devinit*/
/**********************************************************************/
/****************************** devinit *******************************/
/**********************************************************************/
void
devinit(argc,argv) /* initialize device */
int argc;
char *argv[];
{
(void)getbmap();
}
/*-->devterm*/
/**********************************************************************/
/****************************** devterm *******************************/
/**********************************************************************/
void
devterm() /* terminate device */
{
union REGS rg;
rg.x.ax = oldvmode;
if(!first_picture)int86(16,&rg,&rg);
}
#include "dispchar.h"
#include "dvifile.h"
#include "dviinit.h"
#include "dviterm.h"
#include "fatal.h"
#include "fillrect.h"
#include "findpost.h"
#include "fixpos.h"
#include "fontfile.h"
#include "fontsub.h"
void
getbmap() /* allocate bitmap array */
{
static unsigned long huge basebit[ (long)XBIT * (long)(YBIT+2)];
unsigned long *ibit;
unsigned long i, j, k;
unsigned y;
if (bitmap[0] == (UNSIGN32*)NULL) {
for (y = 0; y <= (UNSIGN16)YBIT; ++y)
{
ibit = (unsigned long *) &basebit[ y * XBIT ];
/* UGH! fix up pointers to avoid segment overlap */
i = (unsigned long)ibit & (unsigned long)4;
j = (unsigned long)ibit & (unsigned long) 0x0000fff0L;
k = (unsigned long)ibit & (unsigned long) 0xffff0000L;
i += k + (j << 12);
bitmap[y] = (UNSIGN32*) i;
}
}
}
#include "getbytes.h"
#include "getfntdf.h"
#include "getpgtab.h"
#include "inch.h"
#include "initglob.h"
#include "loadchar.h"
/*-->makechar*/
/**********************************************************************/
/****************************** makechar ******************************/
/**********************************************************************/
char
makechar(p,mask)
UNSIGN32* p[];
register UNSIGN32 mask;
{
}
#include "movedown.h"
#include "moveover.h"
#include "moveto.h"
#include "nosignex.h"
#include "openfont.h"
#include "option.h"
/*-->outline*/
/**********************************************************************/
/****************************** outline *******************************/
/**********************************************************************/
void
outline(pline)
char *pline;
{
}
#include "outrow.h"
/*-->prtbmap*/
/**********************************************************************/
/****************************** prtbmap *******************************/
/**********************************************************************/
void prtbmap()
{
}
#include "prtpage.h"
#include "readfont.h"
#include "readgf.h"
#include "readpk.h"
#include "readpost.h"
#include "readpxl.h"
#include "reldfont.h"
#include "rulepxl.h"
#include "setchar.h"
#include "setfntnm.h"
#include "setrule.h"
#include "signex.h"
#include "skgfspec.h"
#include "skipfont.h"
#include "skpkspec.h"
#include "special.h"
#include "strchr.h"
#include "strcm2.h"
#include "strid2.h"
#include "strrchr.h"
#include "tctos.h"
#include "usage.h"
#include "warning.h"
void
vgainit() /* initialize device */
{
union REGS rg;
char *envptr;
*((unsigned long far *) (0x8c)) = (unsigned long) exfn;
/*
* Oh my! That put a pointer to exfn() in the MS-DOS cntl-break
* interrupt vector!
*/
rg.h.ah = 15;
int86(16,&rg,&rg);
oldvmode = rg.h.al;
envptr = getenv("DVISCR");
if(strcmp(envptr,"EGAM") == 0 && envptr != NULL) displaycode = 5;
else if(strcmp(envptr,"EGAC") == 0 && envptr != NULL) displaycode = 4;
else if(strcmp(envptr,"VGAM") == 0 && envptr != NULL) displaycode = 7;
else if(strcmp(envptr,"VGAC") == 0 && envptr != NULL) displaycode = 30;
else {
rg.x.ax = 0x1a00;
int86(16,&rg,&rg);
if(rg.h.al == 0x1a) {
displaycode = rg.h.bl;
} else {
rg.h.ah = 0x12;
rg.h.bl = 16;
int86(16,&rg,&rg);
if(rg.h.bl == 16) {
displaycode = 0;
} else {
if (oldvmode == 7) displaycode = 5;
else displaycode = 4;
}
}
}
switch (displaycode) {
case 4:
rg.x.ax = 16;
maxm = YBIT-350;
nlines = 350;
break;
case 5:
rg.x.ax = 15;
maxm = YBIT-350;
nlines = 350;
break;
case 7:
case 8:
case 11:
case 12:
rg.x.ax = 17;
maxm = YBIT-480;
nlines = 480;
break;
case 30:
rg.x.ax = 18;
maxm = YBIT-480;
nlines = 480;
break;
default:
puts("Invalid display adapter - requires EGA, VGA, or MCGA.");
exit(1);
}
int86(16,&rg,&rg);
}
void
drawbmap(mline)
int mline;
{
register char *c; /* pointer into v7[] */
unsigned char *q;
unsigned char far *sc;
register UNSIGN32 mask; /* mask for single bit selection */
INT16 i,j,k,ybottom,ytop;
if(first_picture){
first_picture = FALSE;
vgainit();
}
sc = (unsigned char far *)0xa0000000;
ytop = YBIT-nlines-mline;
for (i = nlines-1; i >= 0; i--) {
q = (unsigned char *)BITMAP((ytop+i),0);
if(reversevideo){
for (j = 0; j < 80; j += 4, q += 4) {